#define _CRT_SECURE_NO_WARNINGS	

#include<stdio.h>

void Swap(int* x, int* y)
{
    int tmp = *x;
    *x = *y;
    *y = tmp;
}

void Selection_Sort(int arr[], int len)
{
    for (int i = 0; i < len - 1; i++)
    {
        int k = i;
        for (int j = i + 1; j < len; j++)  
            if (arr[j] < arr[k])
                k = j;
        if (i != k)
            Swap(&arr[i], &arr[k]);
    }
}


int main()
{
    int arr[8] = { 4,3,2,1,9,8,7,6 };
    Selection_Sort(arr, 8);
    for (int i = 0; i < 8; i++)
        printf("%d ", arr[i]);
    return 0;
}